package com.base.logistics.sf.bean;

import com.base.logistics.utils.SfGsonBuilder;
import com.google.gson.JsonElement;

import java.io.Serializable;

/**
 * <pre>
 * 统一处理结果对象
 * </pre>
 * @since 2021-02-16
 */
public class Result<T> implements Serializable {

    /**
     * 是否成功
     */
    private Boolean success;

    /**
     * 错误码
     */
    private String errorCode;

    /**
     * 错误消息
     */
    private String errorMsg;

    /**
     * 响应数据
     */
    private JsonElement msgData;

    public static Result fromJson(String json) {
        return SfGsonBuilder.create().fromJson(json, Result.class);
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public JsonElement getMsgData() {
        return msgData;
    }

    public void setMsgData(JsonElement msgData) {
        this.msgData = msgData;
    }
}
